<template>
    <div>
        <van-cell-group border>
            <van-field v-model="password" label="密码" placeholder="请输入密码..." autofocus />
        </van-cell-group>

        <div class="loginbtn">
            <van-button :disabled="flag" round block type="danger" @click="register">完成</van-button>
        </div>
    </div>
</template>

<script>
import { doFinish, } from "../../api/user";
export default {
    data() {
        return {
            password: '',
        }
    },
    methods: {
        register(){
            doFinish({tel:localStorage.getItem("tel"),password:this.password}).then(res=>{
                console.log(res);
                this.$router.go(-3)
            })  
        }
    },
    computed: {
        flag(){
            if(/^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])\S*$/.test(this.password)){
                return false
            }else{
                return true
            }
        }
    }
}
</script>

<style scoped>
.loginbtn {
    width: 80%;
    margin: 20px auto;
}
</style>